<?php
/**
 * True Gallery Front-End Edit Picture template file
 *
 * @version 2.5
 * @author Alexey N. Brin (userxp@joomlaportal.ru)
 * @homepage http://truegallery.ru 
 * @filename pictures.edit.tpl.php
 * @package True Gallery
 * @copyright (C) 2008-2009 by joomlatune.ru
 * @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
 * 
 * THIS GALLERY is an EVOLUTION of AkoGallery -> PonyGallery -> DatsoGallery
 *
 * If you fork this to create your own project, 
 * please make a reference to True Gallery someplace in your code 
 * and provide a link to http://www.joomlatune.ru
 *
 **/

defined('_VALID_MOS') or defined('_JEXEC') or die('Direct Access to this location is not allowed.');

?>
<script type="text/javascript">
function checkMe() {
	var form = document.adminForm;
	if (form.imgtitle.value == '') {
		alert('<?php echo JText::_('TG_PIC_MUST_HAVE_TITLE'); ?>');
		return false;
	} else if (form.catid.value == '0') {
		alert('<?php echo JText::_('TG_MUST_SELECT_CATEGORY'); ?>');
		return false;
	} else {
		form.submit();
		dgLoading();
	}
}
</script>

<table width="100%" cellpadding="4" cellspacing="0" border="0">
	<tr class="sectiontableheader"><td> <?php echo JText::_('TG_NSDES'); ?></td></tr>
</table>

<?php 
$lo->view	= 'pictures';
$lo->task	= 'savepic';
$lo->catid	= $row->catid;
$lo->id		= $row->id;
$lo->Itemid = getUrlParam( 'Itemid' );

$imgl->view		= 'pictures';
$imgl->task		= 'view';
$imgl->catid	= $row->catid;
$imgl->id		= $row->id;
$imgl->Itemid	= getUrlParam( 'Itemid' );
$link			= getTGLink( $imgl );
?>

<form action="<?php echo getTGLink($lo); ?>" method="post" name="adminForm" enctype="multipart/form-data" onsubmit="checkform();">
	<table cellpadding="0" cellspacing="0" border="0" width="100%">
		<tr>
			<td width="180" valign="top" align="center">
				<?php ob_start(); ?>
				<a href="<?php echo $link; ?>" >
					<img src="<?php echo TG_THUMBSWAY.$row->catid.'/'.$row->imgfilename; ?>" />
				</a>
				<?php $c = ob_get_contents(); ob_end_clean(); echo getRoundedTab($c); ?>
				<?php ob_start(); ?>
				<input type="button" value="<?php echo JText::_('TG_SAVE'); ?>" class="button" onclick="checkMe();" />
				<input type="button" value="<?php echo JText::_('TG_CANCEL_TB'); ?>" class="button" onclick="javascript:history.go(-1);" />
				<?php $c = ob_get_contents(); ob_end_clean(); echo getRoundedTab($c); ?>
			</td>
			<td>
				<?php ob_start(); ?>
				<table>
					<tr>
						<td width="30%" align="left"><?php echo JText::_('TG_TITLE'); ?>:</td>
						<td width="70%">
							<input class="inputbox" type="text" name="imgtitle" size="51" maxlength="100" value="<?php echo htmlspecialchars($row->imgtitle, ENT_QUOTES); ?>" />
						</td>
					</tr>
					<tr>
						<td valign="top" align="left"><?php echo JText::_('TG_CATEGORY'); ?>:</td>
						<td><?php echo $clist; ?></td>
					</tr>
					<tr>
						<td valign="top" align="left"><?php echo JText::_('TG_PUBLISHED'); ?>:</td>
						<td><?php echo writeYesNo( 'published', $row->published ); ?></td>
					</tr>
					<tr>
						<td valign="top" align="left"><?php echo JText::_('TG_APPROWED'); ?>:</td>
						<td><?php echo writeYesNo( '', $row->approved, ' disabled="disabled"'); ?></td>
					</tr>
					<?php //if( $ad_field1 ) {	?>
					<tr>
						<td valign="top" align="left"><?php echo JText::_('TG_FIELD1'); ?>:</td>
						<td>
							<input class="inputbox" type="text" name="field1" id="field1" size="45" maxlength="100" value="<?php echo htmlspecialchars($row->field1, ENT_QUOTES); ?>" />
							<input type="reset" class="button" value="..." onClick="return showCalendar('field1', 'y-mm-dd');" />
						</td>
					</tr><?php //} 
					if( $ad_field2 ) { ?>
					<tr>
						<td valign="top" align="left"><?php echo JText::_('TG_FIELD2'); ?>:</td>
						<td><input class="inputbox" type="text" name="field2" value="<?php echo $row->field2; ?>" size="51" maxlength="100" /></td>
					</tr><?php }
					if( $ad_field3 ) { ?>
					<tr>
						<td valign="top" align="left"><?php echo JText::_('TG_FIELD3'); ?>:</td>
						<td><input class="inputbox" type="text" name="field3" value="<?php echo $row->field3; ?>" size="51" maxlength="100" /></td>
					</tr><?php }
					if( $ad_field4 ) { ?>
					<tr>
						<td valign="top" align ="left"><?php echo JText::_('TG_FIELD4'); ?>:</td>
						<td><input class="inputbox" type="text" name="field4" value="<?php echo $row->field4; ?>" size="51" maxlength="100" /></td>
					</tr><?php }
					if( $ad_field5 ) { ?>
					<tr>
						<td valign="top" align="left"><?php echo JText::_('TG_FIELD5'); ?>:</td>
						<td><input class="inputbox" type="text" name="field5" value="<?php echo $row->field5; ?>" size="51" maxlength="100" /></td>
					</tr><?php } ?>
					<tr>
						<td valign="top" align="left"><?php echo JText::_('TG_TAGS'); ?>:</td>
						<td>
							<input class="inputbox" type="text" name="tags" value="<?php echo $row->tags; ?>" size="51" maxlength="100" />
						</td>
					</tr>
					<tr>
						<td colspan="2" valign="top" style="text-align:right;">
							<label for="gonext"><?php echo JText::_('TG_GOTO_NEXT_IMAGE'); ?>:</label>
							<input type="checkbox" disabled name="gonext" value="0" />
						</td>
					</tr>
				</table>
				
				<?php $c = ob_get_contents(); ob_end_clean(); echo getRoundedTab($c); ?>
				
			</td>
		</tr>
	</table>
		
		<!--tr class="sectiontableentry2">
			<td colspan="2" align="left">
				<div id="status" style="text-align:left;"-->
					

					
					
				<!--/div>
			</td>
		</tr-->

	<table cellpadding="4" cellspacing="3" border="0" width="100%">
		<tr class="sectiontableheader">
			<td colspan="2" valign="top" align="left">
				<?php echo JText::_('TG_DESCRIPTION'); ?>:
			</td>
		</tr>
		<tr>
			<td>
			<?php echo editorArea('editor1', str_replace('&', '&amp;', $row->imgtext), 'imgtext', '500', '200', '70', '10'); ?>
			</td>
		</tr>
	</table>
	
	<input type="hidden" name="option" value="<?php echo TG_CMP; ?>" />
	<input type="hidden" name="view" value="<?php echo $lo->view; ?>" />
	<input type="hidden" name="task" value="<?php echo $lo->task; ?>" />
	<input type="hidden" name="id" value="<?php echo $lo->id; ?>" />
	<input type="hidden" name="oldcatid" value="<?php echo $lo->catid; ?>" />
	<input type="hidden" name="imgfilename" value="<?php echo $row->imgfilename; ?>" />
</form>
<?php

?>